#include "Common.h"
#include "Exceptions.h"
#include "System.h"
#include "AudioFile.h"
#include <fstream>

namespace Audio
{
	namespace IO
	{
		AudioFile::AudioFile(const STRING& path)
			:fileName(path)						
		{
			CreateFileParameters p;
			p.Path = fileName;
			fileReader = IOManager::Get()->CreateFile(p);			
			
		}

		AudioFile::~AudioFile()
		{
			IOManager::Get()->DestroyFile(fileReader);
		}
		
		void	AudioFile::Open(const FileOpenParameters& p)
		{
			fileReader->Open(p);
		}
		void	AudioFile::Close()
		{
			fileReader->Close();
		}

		void    AudioFile::Open()
		{
			FileOpenParameters fop;
			fileReader->Open(fop);
		}


		void AudioFile::Seek(UINT32 pos)
		{
			fileReader->Seek(pos);
		}
		UINT32 AudioFile::Tell()
		{
			return fileReader->Tell();
		}

		UINT32 AudioFile::Read(UINT8* buffer, UINT32 size)
		{
			return fileReader->Read(buffer, size);
		}		
		BOOL AudioFile::Eof()
		{
			return fileReader->Eof();
		}
		
		
		
	}
}